//
//  FansViewController.m
//  xxShare
//
//  Created by 柳麟喆 on 2018/3/27.
//  Copyright © 2018年 lzLiu. All rights reserved.
//

#import "FansViewController.h"
#import "FollowingTableViewCell.h"

@interface FansViewController ()<UITableViewDelegate, UITableViewDataSource>

@property(nonatomic, strong)UITableView *tableview;
@property(nonatomic, copy)NSMutableArray *testData;

@end

@implementation FansViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.title = @"我的粉丝";
    
    _tableview = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, self.view.llz_width, self.view.llz_height) style:UITableViewStyleGrouped];
    _tableview.tableHeaderView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 0, CGFLOAT_MIN)];
    _tableview.sectionFooterHeight = 1;
    _tableview.dataSource = self;
    _tableview.delegate = self;
    _tableview.backgroundColor = BACKGROUND_COLOR;
    [self.view addSubview:_tableview];
    [_tableview registerNib:[UINib nibWithNibName:@"FollowingTableViewCell" bundle:[NSBundle mainBundle]] forCellReuseIdentifier:@"FollowingTableViewCell"];
    _testData = [[NSMutableArray alloc]init];
    _testData = [self addTestData];
}

#pragma mark - *******tableviewDelegate dataSource*******

- (nonnull UITableViewCell *)tableView:(nonnull UITableView *)tableView cellForRowAtIndexPath:(nonnull NSIndexPath *)indexPath {
    static NSString *identify = @"FollowingTableViewCell";
    FollowingTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identify forIndexPath:indexPath];
    [cell setModel:_testData[indexPath.row]];
    NSArray *introduce = @[@"爱分享的王子",@"肚子饿了找我就对了",@"关注大V免费送沙拉酱",@"乐于助人"];
    cell.introduce.text = introduce[indexPath.row];
    return cell;
}

- (NSInteger)tableView:(nonnull UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return _testData.count;
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 1;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 80;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    [tableView cellForRowAtIndexPath:indexPath].selected = NO;
}

- (NSMutableArray *)addTestData{
    NSMutableArray *Data = [[NSMutableArray alloc]init];
    NSArray *avatorArr = @[@"avator2.png",@"avator3.png",@"avator4.png",@"avator5.png"];
    NSArray *nameArr = @[@"叮当猫",@"哪吒",@"球球",@"可达鸭"];
    for (int i = 1; i < 5; i++) {
        NSDictionary* dic = @{@"imageName":avatorArr[i-1],
                              @"name":nameArr[i-1],
                              @"accountID":[NSString stringWithFormat:@"%d", i*100000+i*19],
                              };
        FeedModel *model = [[FeedModel alloc]initWithFeedModel:dic];
        [Data addObject:model];
    }
    return Data;
}

@end
